package org.nepu.scr.indexrate.converter.riskrate.equipmentrisk;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentrisk.EmergencyB22b;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class EmergencyB22bConverter implements AttributeConverter<EmergencyB22b, String> {
    @Override
    public String convertToDatabaseColumn(EmergencyB22b emergencyB22b) {
        return JSONUtil.toJsonStr(emergencyB22b);
    }

    @Override
    public EmergencyB22b convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, EmergencyB22b.class);
    }
}
